from typing import Any, List, overload

import sys
sys.path.append("../workflow4threeman")

from networkit import *

from workflow.Configuration import STATE
from workflow.NetPayLoad import NetPayLoad
from workflow.NetAnalyzer.base_analyzer import BaseAnalyzer, BaseAnalyzerConfig
from workflow.NetAnalyzer.net_constructor import net_constructor

class CommunityAnalyzerConfig(BaseAnalyzerConfig):
    TYPE:str="CommunityPartition"
    def __init__(self) -> None:
        super().__init__()
    
class CommunityAnalyzer(BaseAnalyzer):
    TYPE:str="CommunityPartition"
    def __init__(self,Com_config:CommunityAnalyzerConfig) -> None:
        super().__init__()
        self.config = Com_config
    
    def analyze(
        self,
    ) -> Any:
        net_cons = net_constructor()
        user_graph = net_cons.construction()
        communities = community.detectCommunities(user_graph, inspect=True)
        print(communities.getVector())
        print("社团数目与编号：")
        print(communities.getSubsetIds())
        print("社团下节点编号：")
        print(communities.getMembers(0))
    
        return communities

